package com.nondo.rdp.finance.domain.course;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Index;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.nondo.rdp.auth.domain.User;
import com.nondo.rdp.core.domain.base.BaseEntity;
import com.nondo.rdp.finance.config.DbConfig;

/**
 * 求知-已购买课程
 */
@Entity
@Table(name = DbConfig.DEFAULT_TABLE_PREFIX + "course_buy", indexes = {@Index(columnList = "orderNo,status")})
public class CourseBuy extends BaseEntity {
	
	private static final long serialVersionUID = 4308114350005514295L;
	
	private Long id;// 主键
	private Course course;// 课程
	private User user;// 购买人
	private String orderNo;// 订单ID
	private float amount;// 价格
	private int status;// 状态 -1支付失败|0=未支付|1已支付
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@OneToOne
	@JoinColumn( name = "cid")
	public Course getCourse() {
		return course;
	}

	public void setCourse(Course course) {
		this.course = course;
	}

	@OneToOne
	@JoinColumn( name = "uid")
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public String getOrderNo() {
		return orderNo;
	}

	public void setOrderNo(String orderNo) {
		this.orderNo = orderNo;
	}

	public float getAmount() {
		return amount;
	}

	public void setAmount(float price) {
		this.amount = price;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

}
